package com.bingyuan.aipassproject

import android.content.Intent
import android.os.CountDownTimer
import android.view.View
import com.bingyuan.aipassproject.utils.ShareUtil
import com.bingyuan.aipassproject.view.BaseActivity
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.activity_luck_draw.*
import kotlinx.android.synthetic.main.activity_welcome.*

class WelcomeActivity :BaseActivity(){

    override fun getLayoutResId(): Int {
      return R.layout.activity_welcome
    }

    override fun initView() {
        super.initView()
        Glide.with(this).asGif().load(R.drawable.gif_loading_activity_welcome).into(ivGifLoading)

        if (!intent.getStringExtra("token").isNullOrEmpty()){
            ShareUtil.getInstance().save(ShareUtil.ACCESS_TOKEN, intent.getStringExtra("token"))
            val phone = intent.getStringExtra("phone")
            ShareUtil.getInstance().save(ShareUtil.PHONE, phone)
        }

        val time = object : CountDownTimer(4000, 1000) {
            override fun onTick(millisUntilFinished: Long) {

            }
            override fun onFinish() {
                val intent = Intent(this@WelcomeActivity, HomeActivity::class.java)
                startActivity(intent)
                finish()
            }
        }.start()
    }

    override fun onClick() {

    }

}